package com.mars.admin.modules.goods.entity;

import com.mars.admin.modules.base.entity.BaseEntity;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 商品实体
 *
 * @author Mars
 * @version 1.0
 * @date 2025-01-07
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Table("tb_goods")
@Schema(description = "商品")
public class Goods extends BaseEntity {

    /**
     * 商品ID
     */
    @Id(keyType = KeyType.Auto)
    @Schema(description = "商品ID", example = "1")
    private Long id;

    /**
     * 商品名称
     */
    @Schema(description = "商品名称", example = "户外防水背包")
    private String goodsName;

    /**
     * 商品编码
     */
    @Schema(description = "商品编码", example = "BACKPACK_001")
    private String goodsCode;

    /**
     * 商品货号
     */
    @Schema(description = "商品货号", example = "BP001")
    private String goodsSn;

    /**
     * 分类ID
     */
    @Schema(description = "分类ID", example = "1")
    private Long categoryId;

    /**
     * 品牌ID
     */
    @Schema(description = "品牌ID", example = "1")
    private Long brandId;

    /**
     * 商品类型：1-实物商品，2-虚拟商品
     */
    @Schema(description = "商品类型", example = "1")
    private Integer goodsType;

    /**
     * 主图
     */
    @Schema(description = "主图", example = "https://example.com/main.jpg")
    private String mainImage;

    /**
     * 商品图片集合
     */
    @Schema(description = "商品图片集合", example = "[\"https://example.com/1.jpg\", \"https://example.com/2.jpg\"]")
    private String images;

    /**
     * 商品视频
     */
    @Schema(description = "商品视频", example = "https://example.com/video.mp4")
    private String videoUrl;

    /**
     * 商品简介
     */
    @Schema(description = "商品简介", example = "专业户外背包")
    private String shortDescription;

    /**
     * 商品详情
     */
    @Schema(description = "商品详情", example = "<p>详细描述</p>")
    private String description;

    /**
     * 关键词
     */
    @Schema(description = "关键词", example = "背包,户外,防水")
    private String keywords;

    /**
     * 商品标签
     */
    @Schema(description = "商品标签", example = "[\"防水\", \"大容量\"]")
    private String tags;

    /**
     * 商品规格参数
     */
    @Schema(description = "商品规格参数", example = "{\"材质\":\"尼龙\", \"容量\":\"50L\"}")
    private String specifications;

    /**
     * 市场价
     */
    @Schema(description = "市场价", example = "299.00")
    private BigDecimal marketPrice;

    /**
     * 销售价
     */
    @Schema(description = "销售价", example = "199.00")
    private BigDecimal salePrice;

    /**
     * 成本价
     */
    @Schema(description = "成本价", example = "120.00")
    private BigDecimal costPrice;

    /**
     * 库存数量
     */
    @Schema(description = "库存数量", example = "100")
    private Integer stock;

    /**
     * 库存预警数量
     */
    @Schema(description = "库存预警数量", example = "10")
    private Integer warningStock;

    /**
     * 重量(kg)
     */
    @Schema(description = "重量", example = "1.5")
    private BigDecimal weight;

    /**
     * 体积(m³)
     */
    @Schema(description = "体积", example = "0.1")
    private BigDecimal volume;

    /**
     * 销量
     */
    @Schema(description = "销量", example = "89")
    private Integer salesCount;

    /**
     * 浏览量
     */
    @Schema(description = "浏览量", example = "1256")
    private Integer viewCount;

    /**
     * 收藏量
     */
    @Schema(description = "收藏量", example = "45")
    private Integer favoriteCount;

    /**
     * 评论数
     */
    @Schema(description = "评论数", example = "12")
    private Integer commentCount;

    /**
     * 评分(1-5)
     */
    @Schema(description = "评分", example = "4.8")
    private BigDecimal rating;

    /**
     * 是否新品：0-否，1-是
     */
    @Schema(description = "是否新品", example = "1")
    private Integer isNew;

    /**
     * 是否热门：0-否，1-是
     */
    @Schema(description = "是否热门", example = "1")
    private Integer isHot;

    /**
     * 是否推荐：0-否，1-是
     */
    @Schema(description = "是否推荐", example = "1")
    private Integer isRecommend;

    /**
     * 是否虚拟商品：0-否，1-是
     */
    @Schema(description = "是否虚拟商品", example = "0")
    private Integer isVirtual;

    /**
     * 运费模板ID
     */
    @Schema(description = "运费模板ID", example = "1")
    private Long deliveryTemplateId;

    /**
     * 排序
     */
    @Schema(description = "排序", example = "1")
    private Integer sortOrder;

    /**
     * 商品状态：0-下架，1-上架，2-审核中
     */
    @Schema(description = "商品状态", example = "1")
    private Integer status;

    /**
     * 上架时间
     */
    @Schema(description = "上架时间")
    private LocalDateTime shelfTime;

}
